//
//  ByDetermineCancelView.m
//  recordworktool_ios
//
//  Created by mc on 2017/12/23.
//  Copyright © 2017年 ZhangZhanbin. All rights reserved.
//

#import "ByDetermineCancelView.h"

@implementation ByDetermineCancelView

- (id)init{
    self = [super init];
    if (self){
        
        UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:cancelBtn];
        [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(10);
            make.centerY.equalTo(self).offset(0);
            make.size.mas_equalTo(CGSizeMake(40, 20));
        }];
        cancelBtn.titleLabel.font = FONT(16);
        [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
        [cancelBtn setTitleColor:TEXT_COLOR forState:UIControlStateNormal];
        cancelBtn.tag = 200;
        [cancelBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
        
        UIButton *determineBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:determineBtn];
        [determineBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-10);
            make.centerY.equalTo(self).offset(0);
            make.size.mas_equalTo(CGSizeMake(40, 20));
        }];
        determineBtn.titleLabel.font = FONT(16);
        [determineBtn setTitle:@"确定" forState:UIControlStateNormal];
        [determineBtn setTitleColor:TEXT_COLOR forState:UIControlStateNormal];
        determineBtn.tag = 201;
        [determineBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
        
        
        UILabel *line = [[UILabel alloc] init];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(0);
            make.right.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.height.mas_equalTo(@1);
        }];
        line.backgroundColor = BY_LINE_COLOR;
        
        
        UIButton *allBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:allBtn];
        [allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).offset(0);
            make.centerY.equalTo(self).offset(0);
            make.size.mas_equalTo(CGSizeMake(40, 20));
        }];
        allBtn.titleLabel.font = FONT(16);
        [allBtn setTitle:@"全部" forState:UIControlStateNormal];
        [allBtn setTitleColor:TEXT_COLOR forState:UIControlStateNormal];
        allBtn.tag = 202;
        [allBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return self;
}


- (void)btnAction:(UIButton *)btn{
    if (btn.tag == 200) {
        self.cancel();
    }else if(btn.tag == 201){
        self.determine();
    }else{
        self.all();
    }
    
}

@end
